import Taro, { Component } from '@tarojs/taro'
import { View, Swiper, SwiperItem } from '@tarojs/components'
import './adv.scss'
export class Adv extends Component {

  buttonClick(url, e){
      Taro.navigateTo({
      url: url
    })
  }

  render() {
    const content = this.props.system_ads.map((adv) => {
      return <View className="ad-index" ><SwiperItem>
            <Image src={adv.image} className="ad-index" mode="widthFix" onClick={this.buttonClick.bind(this, adv.url)} />
        </SwiperItem></View>
    })

    return (
            <Swiper
 				  className='mar-h'
                  indicatorColor='#999'
                  indicatorActiveColor='#333'
                  circular
                  indicatorDots
                  autoplay>
                    {content}
            </Swiper>
    )
  }
}